import VueRouter from 'vue-router'
import index from './page/index'
import order from './page/order'
import login from './page/login'
import registered from './page/registered'
import forgotPassword from './page/forgotPassword'
import productDetail from './page/productDetail'
import customize from './page/customize'
import shoppingCart from './page/shoppingCart'
import orderConfirmation from './page/orderConfirmation'
import orderList from './page/orderList'
import payment from './page/payment'
export const constantRouterMap = [
  { path: '/', component: index, name: '首页' },
  { path: '/order', component: order, name: '下单' },
  { path: '/login', component: login, name: '登录' },
  { path: '/registered', component: registered, name: '注册' },
  { path: '/forgotPassword', component: forgotPassword, name: '忘记密码' },
  { path: '/productDetail', component: productDetail, name: '详情' },
  { path: '/customize', component: customize, name: '我要定制' },
  { path: '/shoppingCart', component: shoppingCart, name: '购物车' },
  { path: '/orderConfirmation', component: orderConfirmation, name: '订单确认' },
  { path: '/orderList', component: orderList, name: '订单列表' },
  { path: '/payment', component: payment, name: '付款' },
]
const originalPush = VueRouter.prototype.push
VueRouter.prototype.push = function push (location, onResolve, onReject) {
  if (onResolve || onReject) return originalPush.call(this, location, onResolve, onReject)
  return originalPush.call(this, location).catch(err => err)
}
export default new VueRouter({
  routes: constantRouterMap
})